package com.sunwayworld.basemodule.coredata.test.resource.impl;

import com.sunwayworld.basemodule.coredata.test.resource.LimsTestMethodResource;
import com.sunwayworld.basemodule.coredata.test.service.LimsTestMethodService;
import com.sunwayworld.basemodule.coredata.test.validators.LimsTestMethodDeleteTableValidator;
import com.sunwayworld.framework.log.annotation.Log;
import com.sunwayworld.framework.log.annotation.LogModule;
import com.sunwayworld.framework.log.annotation.LogType;
import com.sunwayworld.framework.restful.data.RestJsonWrapperBean;
import com.sunwayworld.framework.spring.annotation.GikamBean;
import com.sunwayworld.framework.validator.data.annotation.ValidateDataWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

@LogModule("工序方法")
@RestController
@GikamBean
public class LimsTestMethodResourceImpl implements LimsTestMethodResource {

    @Autowired
    private LimsTestMethodService limsTestMethodService;

    @Override
    public LimsTestMethodService getService() {
        return limsTestMethodService;
    }

    @Log(value = "新增工序方法", type = LogType.INSERT)
    @Override
    @RequestMapping(method = RequestMethod.POST)
    public Long insert(RestJsonWrapperBean wrapper) {
        return getService().insert(wrapper);
    }

    @Log(value = "删除", type = LogType.DELETE)
    @ValidateDataWith(LimsTestMethodDeleteTableValidator.class)
    @Override
    public void delete(RestJsonWrapperBean wrapper) {
        getService().delete(wrapper);
    }
}
